#ifndef _TRACE_WIN_H_
#define _TRACE_WIN_H_

#ifdef __DEBUG__
#ifdef _TRACK
#undef _TRACK
#endif

#define _TRACK
#endif

#ifdef _TRACK

inline void _Track(LPCTSTR ptzFormat, ...)
{
	va_list vlArgs;
	TCHAR tzText[1024];
	va_start(vlArgs, ptzFormat);
	wvsprintf(tzText, ptzFormat, vlArgs);
	OutputDebugString(tzText);
	va_end(vlArgs);
}

// #ifdef __FUNCTION__
// #define _TrackSpot()		_Track(TEXT("Track in %s.\n"), TEXT(__PRETTY_FUNCTION__));
// #else // __FUNCTION__
// #define _TrackSpot()		_Track(TEXT("Track in %s. Line %u.\n"), TEXT(__FILE__), __LINE__)
// #endif // __FUNCTION__

#define _TrackSpot()		_Track(TEXT("Track in File:%s line:%u %s.\n"), TEXT(__FILE__), __LINE__, TEXT(__PRETTY_FUNCTION__));
#define _TrackElapse(e)		{DWORD d = GetTickCount(); e; _Track(TEXT("Track %s: Elapse %u ms.\n"), TEXT(#e), GetTickCount() - d);}
#else // _TRACK

// #pragma warning(disable:4353)
// #define _Track				((VOID) (0))
// #define _TrackSpot()
// #define _TrackElapse(e)		((VOID) (e))

inline void _Track(LPCTSTR ptzFormat, ...) {}
#define _TrackSpot()
#define _TrackElapse(e)

#endif // _TRACK

#endif

